package wqlspringboot.springbootcrud.config;

import com.google.common.base.Predicates;
import net.sf.jsqlparser.statement.select.Select;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.service.VendorExtension;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

import javax.print.Doc;
import java.util.ArrayList;

/**
 * @author wql
 * @version 1.0
 * @date 2022/11/18 15:06
 */
@Configuration
public class SwaggerConfiger {
    @Bean
    public Docket docket(){
        Docket docket = new Docket(DocumentationType.SWAGGER_2)
                .groupName("WQL牛逼")
                .apiInfo(getInfo())
                .select()
                //根据路径生成api
               // .paths(Predicates.and(PathSelectors.regex("/user/.*")))
                //根据包名生成api
                .apis(RequestHandlerSelectors.basePackage("wqlspringboot.springbootcrud.controller"))
                .build();


            return docket;
     }
    private ApiInfo getInfo(){
        Contact DEFAULT_CONTACT = new Contact("王乾龙", "http://www.baidu.com", "124325@qq.com");
      ApiInfo  info  = new ApiInfo("用户管理", "用户管理", "2.0", "http://www.baidu.com", DEFAULT_CONTACT, "只因只因BANG", "http://www.taobao.com", new ArrayList());
            return info;
     }
}
